

/*---------------------------------------------------------
   Initializes the effect. The data is a table of data 
   which was passed from the server.
---------------------------------------------------------*/
function EFFECT:Init( data )

	local model = "models/props/cs_office/plant01_gib1.mdl"
	
	self.Pos = data:GetOrigin()
	self.Sc = data:GetScale() //1 or 2
	self.Size = math.random(20,25)
	self.Emitter = ParticleEmitter( data:GetOrigin() )

	//self:SetModel( model )
	//self:PhysicsInit( SOLID_VPHYSICS )
	//self:SetMoveType( MOVETYPE_VPHYSICS )
	//self:SetSolid( SOLID_VPHYSICS ) 
	self:SetPos(self.Pos + Vector(0,0,10) + (VectorRand() * math.random( 1, 10 )))
	
	local b=2

    local min=Vector(0-(b/2),0-(b/2),0-(b/2))
    local max=Vector(b/2,b/2,b/2)

    //Set physics box
    self.Entity:PhysicsInitBox(min,max)
    self.Entity:SetCollisionBounds(min,max)
		
	local phys = self:GetPhysicsObject()
	if ( phys && phys:IsValid() ) then
		phys:Wake()
		phys:SetVelocity(Vector(math.random(-300,300),math.random(-300,300),(math.random(300,400)*self.Sc)))
	end
end

/*---------------------------------------------------------
   THINK
   Returning false makes the entity die
---------------------------------------------------------*/
function EFFECT:Think( )
	self.Size = math.Clamp(self.Size * .989,.1,40)
	
		local particle = self.Emitter:Add("effects/muzzleflash"..math.random(1,4), self:GetPos())
	
		particle:SetVelocity(Vector(math.Rand(-3,3),math.Rand(-3,3),math.Rand(5,50)))
		particle:SetDieTime( math.Rand(.5,1) )
		particle:SetStartAlpha( math.Rand( 90, 110 ) )
		particle:SetEndAlpha(1)
		particle:SetStartSize( self.Size )
		particle:SetEndSize( 0 )
		particle:SetRoll( math.Rand( -95, 95 ) )
		particle:SetRollDelta( math.Rand( -0.12, 0.12 ) )
		particle:SetColor( math.Rand( 150, 255 ), math.Rand( 120, 150 ), 100 )
	
	if self.Size < 1.5 then self.Emitter:Finish() return false end
	return true
end


/*---------------------------------------------------------
   Draw the effect
---------------------------------------------------------*/
function EFFECT:Render()

end
